package today.rocky.elegantcoding.controller;


import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import today.rocky.elegantcoding.common.CommonResult;
import today.rocky.elegantcoding.entity.dto.UserDTO;


/**
 * @author Rocky
 * @version 1.0
 * @date 2020/5/19 12:30
 */
@RestController
@RequestMapping("/param")
public class ParamValidateController {

	/**
	 * @ Valid Validated 效果一样
	 * @param userDTO
	 * @return
	 */
	@PostMapping("/check")
	public CommonResult method(@Validated @RequestBody UserDTO userDTO){
		String u = userDTO.toString();
		System.out.println(u);
		return CommonResult.success(u);
	}
}
